package gui;

import java.io.IOException;

import javax.swing.JTabbedPane;

/**
 * <b>Project ChatSystemG6 INSA 4INFOA1 - 2013/2014</b>
 * <P>
 * <i>Package gui </i> <br>
 * NewDiscussion open a new Discussion Conversation <br>
 * it implements the interface runnable
 * 
 * @author Christelle SIAGO HAPPI
 */
public class NewDiscussion implements Runnable{

	private String contact;
	private ChatGUI gui;
	protected JTabbedPane multichatArea;
	
	/**
	 * The constructor
	 * @param c : the remote user
	 * @param myGui : the  gui assigned
	 * @param multichatArea : the chatRoom area
	 */
	public NewDiscussion(String c, ChatGUI myGui, JTabbedPane multichatArea){
		this.contact = c;
		this.gui = myGui;
		this.multichatArea = multichatArea;
	}
	/**
	 * add the Discussion in the ChatRoom Area
	 */
	@Override
	public void run() {
		try {
			multichatArea.addTab(contact, gui.createPage(contact));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
